package com.weayer.service;

import com.weayer.constant.IdentityConstants;
import com.weayer.dto.OrderInfo;
import com.weayer.dto.ResponseResult;
import com.weayer.remote.ServiceOrderClient;
import com.weayer.request.OrderRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @description: Api服务 - 乘客 - 下单service
 * @author: Weayer
 **/
@Service
public class OrderService {
    @Autowired
    ServiceOrderClient serviceOrderClient;

    /**
     * @Description: 创建乘客实时订单
     * @Param: [orderRequest]
     * @return: com.weayer.dto.ResponseResult
     **/
    public ResponseResult add(@RequestBody OrderRequest orderRequest){
        return serviceOrderClient.add(orderRequest);
    }

    /**
     * @Description: 创建乘客预约订单
     * @Param: [orderRequest]
     * @return: com.weayer.dto.ResponseResult
     **/
    public ResponseResult book(@RequestBody OrderRequest orderRequest){
        return serviceOrderClient.book(orderRequest);
    }

    /**
     * @Description: 根据 orderId 查看订单详情
     * @Param: [orderId]
     * @return: com.weayer.dto.ResponseResult<com.weayer.dto.OrderInfo>
     **/
    public ResponseResult<OrderInfo> detail(Long orderId){
        return serviceOrderClient.detail(orderId);
    }
    /**
     * @Description: 根据 identity, phone 查看订单详情
     * @Param: [phone, identity]
     * @return: com.weayer.dto.ResponseResult<com.weayer.dto.OrderInfo>
     **/
    public ResponseResult<OrderInfo> currentOrder(String phone, String identity){
        return serviceOrderClient.current(phone,identity);
    }
}
